package cn.pugle.base.nio;

import java.io.FileInputStream;

/**
 * @author tzp
 * @since 2020/8/31
 */
public class FileStreamTest {
    public static void main(String[] args) throws Exception {
        test1();
    }

    static void test1() throws Exception {
        FileInputStream stream = new FileInputStream("/Users/tzp/Documents/private/cnm/CodeAccumulate/src/main/java/cn/pugle/base/nio/xx.txt");
        byte[] bytes = new byte[1024];
        int offset = 0;
        while (true) {
            int num = stream.read(bytes, offset, 10);
            if (num != -1) {
                System.out.println(new String(bytes, offset, num));
                offset += num;
            } else {
                System.out.println("read nth");
            }
        }
    }
}
